package com.ricchieri.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Inheritance(strategy=InheritanceType.JOINED)
@Table(name="userEmail")
public class UserEmail extends BaseEntity {
	private static final long serialVersionUID = -7467185688422338869L;

	@Column(name="email", nullable=false, length=80)
	private String email;
	
	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "emailType", nullable = false)
	private EmailType emailType;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user", nullable = false)
	private User user;
	
	@Column(name="isDefault")
	private Boolean isDefault = Boolean.FALSE;
	
	public UserEmail(){
		
	}
	
	public UserEmail(String email, EmailType emailType, User user) {
		this.emailType = emailType;
		this.email = email;
		this.user = user;
	}
	
	public String getEmail() {
		return email;
	}
	
	public void setEmail(String email) {
		this.email = email;
	}
	
	public EmailType getEmailType() {
		return emailType;
	}
	
	public void setEmailType(EmailType emailType) {
		this.emailType = emailType;
	}
	
	public User getUserEmail() {
		return user;
	}
	
	public void setUserEmail(User userEmail) {
		this.user = userEmail;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Boolean getIsDefault() {
		return isDefault;
	}

	public void setIsDefault(Boolean isDefault) {
		this.isDefault = isDefault;
	}	
	
}